package com.wwt.blog.controller;

import com.wwt.blog.service.SysUserService;
import com.wwt.blog.vo.Result;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Log4j2
@RestController
@RequestMapping("/users")
public class UserController {
    @Resource
    SysUserService sysUserService;
    @GetMapping("/currentUser")
    public Result getCurrentUser(@RequestHeader("Authorization") String token){
        //根据Token查找用户
        //log.info("#########"+token);
        return sysUserService.getUserByToken(token);
    }
}
